<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link rel="stylesheet" type="text/css" href="__ADMIN__style/houtai_public.css"/>
    <link rel="stylesheet" type="text/css" href="__ADMIN__style/houtai.css"/>
</head>

<body>
<div class="main_part">
    <h1 class="main_title">系统管理</h1>
    <div class="main_subtitle">
        <h2>题库管理</h2>
    </div>
    <!--筛选条件-->
    <div class="shaixuan_tj mb10">
        <form action="">
            <!--项目-->
            <div class="sxtj_item clearfix">
                <span class="sxtj_t_txt">问题名称：</span>
                <div class="sxtj_i_input">
                    <input type="text" class="inputs w180" value=""/>
                </div>
            </div>
            <!--项目 end-->

            <!--项目-->
            <div class="sxtj_item clearfix last_item">
                <div class="sxtj_i_input">
                    <input type="submit" class="sxtj_i_bluebtn btn fl mr10" value="搜 索"/>
                    <input type="reset" class="sxtj_i_graybtn btn fl" value="重 置" />
                </div>
            </div>
            <!--项目 end-->
        </form>
        <div class="clears"></div>
    </div>
    <!--筛选条件 end-->

    <!--操作按钮-->
    <div class="btn_area clearfix mb10">
        <p class="fr">
            共 <strong class="c_green">5</strong> 条记录
        </p>
        <p>
            <a href="{:url('Questions/addquestion')}" target="mainFrame" class="w80 btn btn_green">新增</a>
            <a href="JavaScript:;" target="mainFrame" class="w80 btn btn_green edit">编辑</a>
            <input type="button" value="删除" class="w80 btn btn_white delete"
                   style="background: #7DCD00;color:#FFF;border:1px #6eb300 solid"/>
        </p>
    </div>
    <!--操作按钮 end-->

    <!--数据表格-->
    <table width="100%" class="pd5_bg mb10 table_1px date_table"  border="0" cellspacing="0" cellpadding="0">
        <tr>
            <th scope="col" width="20" align="center">
                <input type="checkbox" class="chooseAll" id="chooseAll" />
            </th>

            <th scope="col" align="center">编号</th>
            <th scope="col" align="center">问题名称</th>
            <th scope="col" align="center">答案</th>

        </tr>

        {volist name="questionList" id="question" empty= "$emptyHtml" }
        <tr>
            <td align="center"><input type="checkbox"  class="chooseOne" value="{$question.id}"/></td>
            <td align="center"><a href="#">{$question.id}</a></td>
            <td align="center">{$question.question}</td>
            <td align="center">{$question.answer}</td>
        </tr>
        {/volist}




    </table>
    <!--数据表格 end-->

    <!--更改页码-->
    <div class="clearfix">

        <div class="fl">
            <!--下拉-->
            <dl class="selects rel w60">
                <input type="hidden" value="1">
                <dt><span>1</span></dt>
                <dd class="abs">
                    <div class="selects_nr">
                        <a href="javascript:void(0)">1</a>
                        <a href="javascript:void(0)">2</a>
                    </div>
                </dd>
            </dl>
            <!--下拉 end-->
        </div>

        <!--刷新-->
        <a href="#" class="ht_icons i_shuaxin fl ml10 mt2"><span>刷新</span></a>
        <!--刷新 end-->

        <!--翻页-->
        <div class="fr changepages">
            <ul>
                <li>共<span>200</span>条记录</li>
                <li><a href="#" title="首页" class="ht_icons i_firstP"><span>首页</span></a></li>
                <li><a href="#" title="上一页" class="ht_icons i_prevP"><span>上一页</span></a></li>
                <li>1/100</li>
                <li><a href="#" class="ht_icons i_nextP"><span>下一页</span></a></li>
                <li><a href="#" class="ht_icons i_lastP"><span>末页</span></a></li>
                <li>到第<input type="text" class="inputs w40 ml2 mr2 t_center" value="1">页</li>
                <li><input type="button" class="ht_icons btn i_go" /></li>
            </ul>
        </div>
        <!--翻页 end-->
    </div>
    <!--更改页码 end-->








</div>
<script type="text/javascript" src="__ADMIN__scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="__ADMIN__scripts/date.js"></script>
<script type="text/javascript" src="__ADMIN__scripts/houtai.js"></script>
<script>
    //删除问题
    $(".delete").click(function(){

        if($(".chooseOne:checked").length>0){
            let rid = "";
            var message=window.confirm('是否删除？');
            if(message == true){
                $(".chooseOne:checked").each(function(){
                    rid += $(this).val()+",";
                    window.location.href='index.html';
                    $.post("{:url('deletequestion')}",{"rid":rid},function(res){
                        if(res.flag == "1"){
                            alert(res.msg);
                        }else{
                            alert("删除成功");
                            window.location.href = window.location.href;
                        }
                    })
                });
            }
            else{
                window.location.href = window.location.href;
            }
        }
        else{
            alert("至少选择一条！");
        }
    });

    //编辑题目
    $(".edit").click(function () {

        if($(".chooseOne:checked").length==1){
            var message = window.confirm('是否修改密码？');
            if(message == true){
                let rid = $(".chooseOne:checked").val();
                $(".edit").attr("href","editquestion?id="+rid);
            }else{
                window.location.href=window.location.href;
            }
        } else{
            alert("请选择一条！");
            window.location.href=window.location.href;
        }

    });

</script>
</body>
</html>
